package com.appkubes.mall.restful.common.constant;

/**
 * @Author: Rongjie
 * @Date: 2020/1/5 14:41
 * @Description: 租期编码转换
 */

public enum RentOrderPeriodCode {
    DAY1("DAY1", 1, 1),
    DAY2("DAY2", 1, 2),
    DAY3("DAY3", 1, 3),
    DAY4("DAY4", 1, 4),
    DAY5("DAY5", 1, 5),
    DAY6("DAY6", 1, 6),
    DAY7("DAY7", 1, 7),
    DAY8("DAY8", 1, 8),
    DAY9("DAY9", 1, 9),
    DAY10("DAY10", 1, 10),
    DAY11("DAY11", 1, 11),
    DAY12("DAY12", 1, 12),
    DAY13("DAY13", 1, 13),
    DAY14("DAY14", 1, 14),
    DAY15("DAY15", 1, 15),
    DAY16("DAY16", 1, 16),
    DAY17("DAY17", 1, 17),
    DAY18("DAY18", 1, 18),
    DAY19("DAY19", 1, 19),
    DAY20("DAY20", 1, 20),
    DAY21("DAY21", 1, 21),
    DAY22("DAY22", 1, 22),
    DAY23("DAY23", 1, 23),
    DAY24("DAY24", 1, 24),
    DAY25("DAY25", 1, 25),
    DAY26("DAY26", 1, 26),
    DAY27("DAY27", 1, 27),
    DAY28("DAY28", 1, 28),
    DAY29("DAY29", 1, 29),
    DAY30("DAY30", 1, 30),
    DAY31("DAY30", 1, 30),
    WEEK1("WEEK1", 2, 1),
    WEEK2("WEEK2", 2, 2),
    WEEK3("WEEK3", 2, 3),
    WEEK4("WEEK4", 2, 4),
    WEEK5("WEEK5", 2, 5),
    WEEK6("WEEK6", 2, 6),
    WEEK7("WEEK7", 2, 7),
    WEEK8("WEEK8", 2, 8),
    WEEK9("WEEK9", 2, 9),
    WEEK10("WEEK10", 2, 10),
    WEEK11("WEEK11", 2, 11),
    WEEK12("WEEK12", 2, 12),
    WEEK13("WEEK13", 2, 13),
    WEEK14("WEEK14", 2, 14),
    WEEK15("WEEK15", 2, 15),
    WEEK16("WEEK16", 2, 16),
    WEEK17("WEEK17", 2, 17),
    WEEK18("WEEK18", 2, 18),
    WEEK19("WEEK19", 2, 19),
    WEEK20("WEEK20", 2, 20),
    WEEK21("WEEK21", 2, 21),
    WEEK22("WEEK22", 2, 22),
    WEEK23("WEEK23", 2, 23),
    WEEK24("WEEK24", 2, 24),
    WEEK25("WEEK25", 2, 25),
    WEEK26("WEEK26", 2, 26),
    WEEK27("WEEK27", 2, 27),
    WEEK28("WEEK28", 2, 28),
    WEEK29("WEEK29", 2, 29),
    WEEK30("WEEK30", 2, 30),
    MONTH1("MONTH1", 3, 1),
    MONTH2("MONTH2", 3, 2),
    MONTH3("MONTH3", 3, 3),
    MONTH4("MONTH4", 3, 4),
    MONTH5("MONTH5", 3, 5),
    MONTH6("MONTH6", 3, 6),
    MONTH7("MONTH7", 3, 7),
    MONTH8("MONTH8", 3, 8),
    MONTH9("MONTH9", 3, 9),
    MONTH10("MONTH10", 3, 10),
    MONTH11("MONTH11", 3, 11),
    MONTH12("MONTH12", 3, 12),
    YEAR1("YEAR1", 4, 1),
    YEAR2("YEAR2", 4, 2),
    YEAR3("YEAR3", 4, 3),
    OTHER("OTHER", 99, 1);

    RentOrderPeriodCode(String periodsCode, Integer periodType, Integer periods) {
        this.periodsCode = periodsCode;
        this.periods = periods;
        this.periodType = periodType;
        switch (periodType) {
            case 1:
                this.periodDays = periods;
                break;
            case 2:
                this.periodDays = periods * 7;
                break;
            case 3:
                this.periodDays = periods * 30;
                break;
            case 4:
                this.periodDays = periods * 365;
                break;
            default:
                this.periodDays = periods;

        }
    }

    String periodsCode;
    Integer periods;
    Integer periodType; //本来我是用String的，但要兼容别人的做法，所以只能用数字了, : 1 ：日，2：月， 3周，4年
    Integer periodDays;

    public String getPeriodsCode() {
        return periodsCode;
    }

    public void setPeriodsCode(String periodsCode) {
        this.periodsCode = periodsCode;
    }

    public Integer getPeriods() {
        return periods;
    }

    public void setPeriods(Integer periods) {
        this.periods = periods;
    }

    public Integer getPeriodType() {
        return periodType;
    }

    public void setPeriodType(Integer periodType) {
        this.periodType = periodType;
    }

    public Integer getPeriodDays() {
        return periodDays;
    }

    public void setPeriodDays(Integer periodDays) {
        this.periodDays = periodDays;
    }}
